package com.ruoyi.system.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataScope;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ContestCollectMapper;
import com.ruoyi.system.domain.ContestCollect;
import com.ruoyi.system.service.IContestCollectService;

/**
 * 参赛报名Service业务层处理
 *
 * @author suncf
 * @date 2024-03-31
 */
@Service
public class ContestCollectServiceImpl extends ServiceImpl<ContestCollectMapper, ContestCollect> implements IContestCollectService
{
    @Autowired
    private ContestCollectMapper contestCollectMapper;


    /**
     * 查询参赛报名列表
     *
     * @param contestCollect 参赛报名
     * @return 参赛报名
     */
    @Override
    public List<ContestCollect> queryList(ContestCollect contestCollect)
    {
        QueryWrapper<ContestCollect> queryWrapper = Wrappers.query();
            if(StringUtils.isNotEmpty(contestCollect.getContestName())){
                queryWrapper.like("contest_name", contestCollect.getContestName());
            }
            if(StringUtils.isNotEmpty(contestCollect.getContestPhone())){
                queryWrapper.like("contest_phone", contestCollect.getContestPhone());
            }
            if(StringUtils.isNotEmpty(contestCollect.getWorkTitle())){
                queryWrapper.eq("work_title", contestCollect.getWorkTitle());
            }
               // 这里需要手动添加范围查询条件

        return this.list(queryWrapper);
    }


    /**
     * 查询参赛报名  按部门 角色 权限查询
     *
     * @param id 参赛报名主键
     * @return 参赛报名
     */
    @Override
    @DataScope(deptAlias = "d",userAlias="u")
    public List<ContestCollect> selectContestCollectList(ContestCollect contestCollect)
    {
        return contestCollectMapper.selectContestCollectList(contestCollect);
    }


}
